import java.util.*;

public class Demo {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        //双端队列
        LinkedList<Integer> queue = new LinkedList<>();
        for (int i = 0; i < n; i++) {
            queue.offer(sc.nextInt());
        }

        for (int i = 1; i <= n; i++) {
            if (i % 2 == 0) {//小Q
                if (queue.getFirst() > queue.getLast()) {
                    System.out.print(queue.getLast() + " ");
                    queue.removeLast();
                } else {
                    System.out.print(queue.getFirst() + " ");
                    queue.removeFirst();
                }
            } else {//大Q
                if (queue.getFirst() > queue.getLast()) {
                    System.out.print(queue.getFirst() + " ");
                    queue.removeFirst();
                } else {
                    System.out.print(queue.getLast() + " ");
                    queue.removeLast();
                }
            }
        }
    }
}

